import Vue from 'vue'
import Vuex from 'vuex'
import common from './common'

Vue.use(Vuex)
let store = new Vuex.Store({
  modules: {
    common
  },
  state: {
    scrollBottom: 0,
    device: {
      width: 0
    }
  },
  getters: {
    deviceWidth (state) {
      return state.device.width
    }
  },
  mutations: {
    updateDeviceWidth (state, val) {
      console.log(val, 'mutations : updateDeviceWidth')
      state.device.width = val
    },
    updateScrollBottom (state, val) { // 计算滚动条距底部距离，用于上滑加载更多数据
      state.scrollBottom = val
    }
  },
  actions: {
  }
})

export default store
